/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/*!
  \file			aspaceid.h
  \date			Sep 2012
  \author		TNick

  \brief		Contains the definition for ASpaceID class


*//*


 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Please read COPYING and README files in root folder
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
#ifndef __ASPACEID_INC__
#define __ASPACEID_INC__
//
//
//
//
/*  INCLUDES    ------------------------------------------------------------ */

#include	<cpg/atoms/pgatomicchg.h>

/*  INCLUDES    ============================================================ */
//
//
//
//
/*  CLASS    --------------------------------------------------------------- */

namespace	BBlocks		{
class	UserMsg;
}

namespace	cpg		{


/**
*	@brief	Atomic change that allows creating/deleting a space
*/
class CPGSHARED_EXPORT  ASpaceID		: public AtomicChg			{
	BBM_TRACK( ASpaceID );

	//
	//
	//
	//
	/*  DEFINITIONS    ----------------------------------------------------- */

	/*  DEFINITIONS    ===================================================== */
	//
	//
	//
	//
	/*  DATA    ------------------------------------------------------------ */

private:


	/**
	*	@brief	the space that is created / deleted
	*/
	PgSpace *			new_space_;


	/*  DATA    ============================================================ */
	//
	//
	//
	//
	/*  FUNCTIONS    ------------------------------------------------------- */

private:


	/**
	*	@brief	constructor;
	*/
	ASpaceID			( CpgDoc * doc );


	/**
	*	@brief	destructor;
	*/
	~ASpaceID			( void );


	/**
	*	@brief	recreate the effect of this change
	*/
	void				redoAtom			( void )
	{ doUndoRedo( !isReversed() ); }


	/**
	*	@brief	undo the effect of this change
	*/
	void				undoAtom			( void )
	{ doUndoRedo( isReversed() ); }


	/**
	*	@brief	undo the effect of this change
	*/
	void				doUndoRedo			( bool b_effect );


	/**
	*	@brief	is this the delete variant or the create variant
	*/
	inline bool			isDeleteVariant		( void ) const
	{ return isReversed(); }


public:


	/**
	*	@brief	short description for this action
	*/
	QString				shortDescr			( void ) const
	{ return ( isDeleteVariant() ?
				   QObject::tr( "Delete space" ) :
				   QObject::tr( "Create space" ) );
	}


public:


	/**
	*	@brief	inserts the space in provided document
	*
	*	If \b doc is NULL current document is assumed
	*	If \b space is NULL a new, default one is created
	*/
	static ASpaceID *	createSpace			(
			BBlocks::UserMsg &	um,
			CpgDoc *				doc = NULL,
			PgSpace *			space = NULL
			);


	/**
	*	@brief	deletes the space from
	*
	*	If \b doc is NULL current document is assumed
	*	If \b space is NULL a new, current space is assumed
	*/
	static ASpaceID *	deleteSpace			(
			BBlocks::UserMsg &	um,
			CpgDoc *				doc = NULL,
			PgSpace *			space = NULL
			);


	/*  FUNCTIONS    ======================================================= */
	//
	//
	//
	//

};	/*	class ASpaceID	*/

/*  CLASS    =============================================================== */
//
//
//
//

}	//	namespace	cpg

#endif // __ASPACEID_INC__
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
